package serverDB_classes;

import org.hibernate.Session;
/**
 * manage CheckSum instance at the data base
 * @author Yoav
 *
 */
public class CheckSumsManager {

	/*
	 * save checkSum in data base 
	 * @param session - session for data base
	 * @param checkSums - checkSum instance
	 */
	private void save(Session session, CheckSums checkSums) {
		session.save(checkSums);		
		session.flush();		
		
	}

	/**
	 * create a new checkSum instance
	 * @param session open data base session
	 * @param checkSum checkSum value
	 */
	public void create(Session session,String checkSum) {
		CheckSums chkSum=new CheckSums();
		chkSum.setCheckSum(checkSum);
		save(session,chkSum);
	}
	/**
	 * delete checkSum from data base
	 * @param session open data base session
	 * @param checkSum checkSum instance
	 */
	public void delete(Session session,CheckSums checkSum) {
		  session.delete(checkSum);
		  session.flush();
	}
}
